"use strict";

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, io } = app;
  router.post("/v1/login", controller.login.index);
  router.post("/v1/logout", controller.login.logout);


  router.post("/v1/register", controller.login.register);
  router.post("/v1/app/register", controller.login.appRegister);
  router.get("/v1/app/getUser", controller.login.appGetUser);
  router.get("/v1/home/productList", controller.home.phoneList);
  router.get("/v1/test/productList", controller.home.phoneList);
  router.get("/v1/home/banner", controller.home.banner);
  router.get("/v1/home/filterMenu", controller.home.filterMenu);
  router.get("/v1/home/phoneDetail", controller.phone.phoneDetail);
  router.post("/v1/home/addCart", controller.home.addCart);
  router.get("/v1/home/getCart", controller.home.getCart);
  router.post("/v1/home/changeCartNum", controller.home.changeNum);
  router.post("/v1/home/deleteCart", controller.home.deleteCart);
  router.get("/v1/home/getCartNum", controller.home.getCartNum);

  router.get("/v1/book/banner", controller.book.banner);
  router.get("/v1/book/detail", controller.book.detail);
  router.post("/v1/home/pay", controller.home.pay);

  router.get("/v1/attencedata", controller.management.attencedata);
  router.get("/v1/getmembers", controller.management.getmembers);

  router.get("/v1/test/getMembers", controller.test.getMembers);
  router.get("/v1/test/recommend", controller.management.recommend);
  router.post("/v1/test/deleteMember", controller.management.deleteMember);

  router.get("/v1/test/phoneList", controller.home.phoneList);
  router.get("/v1/test/getlist", controller.test.getlist);
  router.get("/v1/test/getlistmore", controller.test.getlistMore);

  router.post("/v1/test/onLogin", controller.test.onLogin);

  router.get("/v1/test/getWeiboList", controller.webo.getWeboList);
  router.get("/v1/test/getVideoList", controller.webo.getVideoList);
  router.get("/v1/test/add", controller.webo.add);
  router.post("/v1/test/addWeibo", controller.webo.addWeibo);
  router.post("/v1/test/deleteWeibo", controller.webo.deleteWeibo);
  router.post("/v1/test/like", controller.webo.like);
  router.get("/v1/test/search", controller.webo.search);
  router.get("/v1/test/getHotSearch", controller.webo.getHotSearch);
  router.get("/v1/test/getMessageList", controller.webo.getMessageList);
  router.get("/v1/test/getHotImage", controller.webo.getHotImage);
  // router.post("/v1/test/getfollowlist", controller.test.getfollowlist);
  // router.post("/v1/test/gethotlist", controller.test.gethotlist);

  io.of("/").route("msg", io.controller.test.msg);

  //app mall
  router.get("/v1/test/getGuessLikeList", controller.appMall.getGuessLikeList);
  router.get("/v1/test/getNewGoodsList", controller.appMall.getNewGoodsList);
  router.get("/v1/test/getMainMenu", controller.appMall.getMainMenu);
  router.get("/v1/test/banner", controller.appMall.banner);
  router.get("/v1/test/newBanner", controller.appMall.newBanner);
  router.get("/v1/test/getProductDetail", controller.appMall.getProductDetail);
  router.get("/v1/mall/getCart", controller.appMall.getCart);
  router.post("/v1/mall/changeNum", controller.appMall.changeNum);
  router.post("/v1/mall/addCart", controller.appMall.addCart);
  router.get("/v1/mall/getCartNum", controller.appMall.getCartNum);
  router.post("/v1/mall/deleteCart", controller.appMall.deleteCart);
  router.get("/v1/test/getTopic", controller.appMall.getTopic);
  router.get("/v1/test/getOrder", controller.appMall.getOrder);

  //article
  router.get("/v1/test/getArticle", controller.book.getArticles);
  router.post("/v1/test/addArticle", controller.book.addArticles);
  router.post("/v1/test/deleteArticle", controller.book.deleteArticles);
  router.post("/v1/test/editArticle", controller.book.editArticles);
  router.get("/v1/test/article/add", controller.book.add);
  // router.get("/v1/test/searchArticle", controller.book.searchArticles);

  // chat
  router.get("/v1/test/getChatToken", controller.test.getChatToken);

  //vdmanager
  router.post("/v1/test/upload", controller.vdmanager.upload);
  router.post("/v1/test/add", controller.vdmanager.add);
  router.post("/v1/test/addMember", controller.vdmanager.addMember);
  router.get("/v1/test/get", controller.vdmanager.getList);
  router.get("/v1/test/getMember", controller.vdmanager.getMemberList);
  router.post("/v1/test/update", controller.vdmanager.update);
  router.post("/v1/test/updateMember", controller.vdmanager.updateMember);
  router.post("/v1/test/remove", controller.vdmanager.remove);
  router.post("/v1/test/removeMember", controller.vdmanager.removeMember);

  // 健康助手
  router.get('/v1/test/getFoodsList', controller.food.getFoodsList)
  router.get('/v1/test/getFoodsDetail', controller.food.getFoodsDetail)
  router.post('/v1/test/addFoodRecord', controller.food.addFoodRecord)
  router.get('/v1/test/getFoodListById', controller.food.getFoodListById)
  router.post('/v1/test/deleteFoodRecord', controller.food.deleteFoodRecord)
  router.get('/v1/test/getWeather', controller.test.getWeather)
  router.get('/v1/test/fanyi', controller.test.fanyi)
  router.get('/v1/test/robot', controller.test.robot)

  //agent
  router.post("/v1/agent/create", controller.agent.create);
  router.post("/v1/agent/delete/:id", controller.agent.delete);
  router.post("/v1/agent/update/:id", controller.agent.update);
  router.get("/v1/agent/get/:id", controller.agent.get);
  router.get("/v1/agent/list", controller.agent.getAll);
  router.get("/v1/agent/search", controller.agent.search);
  router.get("/v1/agent/favorite", controller.agent.getFavoriteAgents);
  router.get("/v1/agent/banner", controller.agent.getCarouselImages);

  // chat
  router.get("/v1/chat/getUser", controller.login.getUser);
  router.post("/v1/chat/updateUser", controller.login.updateUser);
  router.post("/v1/chat/create", controller.chat.addChatData);
  router.get("/v1/chat/getChat", controller.chat.getChatDetailById);
  // 更新消息
  router.post("/v1/chat/sent", controller.chat.addNewChatData);
  router.get("/v1/chat/list", controller.chat.getAllChatsByUser);
  router.get("/v1/chat/all", controller.chat.getAllChatsByUser2);
  router.post("/v1/chat/update/title", controller.chat.updateTitle);  // 更新标题
  router.post("/v1/chat/delete/:id", controller.chat.deleteChatById);
  // 配置通过title搜索列表数据的路由
  router.post('/v1/chat/search', controller.chat.searchChatsByTitle);
  router.post("/v1/chat/saveMenus", controller.chat.saveMenus);

  // 新闻搜索
  router.get("/v1/chat/news", controller.chat.searchNews);
  router.get("/v1/chat/menus", controller.chat.menus);
  router.get('/v1/chat/getAbout', controller.agent.getAbout)
  router.post('/v1/chat/similar', controller.blog.similar);

  // image
  router.post("/v1/image/create", controller.image.NewImage);
  router.get("/v1/image/list", controller.image.getImageList);
  router.get("/v1/image/all", controller.image.getAllImages);
  router.get('/v1/image/collect/list', controller.image.getCollectedImages);
  router.post('/v1/image/collect', controller.image.addToCollection);
  router.post('/v1/image/collect/delete', controller.image.deleteCollection);
  // 配置添加数据到collect表的路由
  router.post('/v1/chat/collect/create', controller.chat.addToCollect);
  // 配置根据关键词搜索收藏内容的路由
  router.get('/v1/chat/collect/search', controller.chat.searchCollectByKeyword);
  // 配置根据id获取一条收藏数据的路由
  router.get('/v1/chat/collect/detail/:id', controller.chat.getCollectDataById);
  // 配置根据id删除一条收藏数据的路程
  router.post('/v1/chat/collect/delete/:id', controller.chat.deleteCollectById);
  // 配置获取我的收藏数据的路由
  router.get('/v1/chat/collect/list', controller.chat.getMyCollectData);
  router.post('/v1/chat/collect/comment', controller.chat.addCommentToCollect);
  router.post('/v1/image/uploadImage', app.controller.image.uploadImage);
  router.get('/v1/image/recognition/list', app.controller.image.getMyRecognitionImages);

  //
  router.get("/v1/exam/banner", controller.appMall.getBanner);
  // router.get("/v1/exam/list", controller.appMall.getNewsList);
  router.get("/v1/exam/getMallList", controller.appMall.getMallList);
  router.get('/v1/exam/list', controller.blog.getAllBlogs);
  router.get('/v1/exam/detail/:id', controller.blog.getBlogById);
  router.get('/v1/exam/addBlog', controller.blog.addBlog);
  router.post('/v1/exam/addComment', controller.blog.addComment);
  router.get('/v1/exam/like/:id', controller.blog.addLike);
  router.get('/v1/exam/getGroup', controller.blog.getGroup);
  router.post('/v1/exam/addCart', controller.appMall.addCart1);
  router.get('/v1/exam/getCart', controller.appMall.getCart);
  router.post('/v1/exam/joinGroup', controller.blog.saveGroup);
  router.get('/v1/exam/myGroup', controller.blog.myGroup);

  router.get('/v1/chat/population', controller.blog.population);
};
